package com.person.webdemoproject2.mapper;

import com.person.webdemoproject2.pojo.UserRelationship;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface UserMapper {
    //@Insert("insert into userrelationship (id, userid, followed_person, create_time, update_time) VALUES (#{id},#{userid},#{followed_person},#{create_time},#{update_time})")
    void follow(UserRelationship userRelationship);

    @Select("select userrelationship.fusername from userrelationship where userid=#{userid}")
    List<String> refollow(UserRelationship userRelationship);

    @Select("select userrelationship.followed_person from userrelationship where userid=#{userid} AND create_time=#{now}")
    Integer selectIdByusername(LocalDateTime now, Integer userid);
}
